﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.IO;
using System.Xml;

namespace SpaceShooter.Settings
{
    public static partial class GameSettings
    {
        public static class CameraSettings
        {
            /// <summary>
            /// the nearplane of the camera
            /// </summary>
            private static float mNearPlane;

            /// <summary>
            /// the nearplane of the camera
            /// </summary>
            public static float NearPlane
            {
                get { return mNearPlane; }
                set { mNearPlane = value; }
            }

            /// <summary>
            /// the far plane of the camera
            /// </summary>
            private static float mFarPlane;

            /// <summary>
            /// the far plane of the camera
            /// </summary>
            public static float FarPlane
            {
                get { return mFarPlane; }
                set { mFarPlane = value; }
            }

            /// <summary>
            /// the FOV of the camera
            /// </summary>
            private static float mFieldOfView = MathHelper.PiOver4;

            /// <summary>
            /// the FOV of the camera
            /// </summary>
            public static float FieldOfView
            {
                get { return mFieldOfView; }
                set { mFieldOfView = value; }
            }

            /// <summary>
            /// the position of the camera
            /// </summary>
            private static Vector3 mPosition;

            /// <summary>
            /// the position of the camera
            /// </summary>
            public static Vector3 InitPosition
            {
                get { return CameraSettings.mPosition; }
                set { CameraSettings.mPosition = value; }
            }

            /// <summary>
            /// the target of the camera
            /// </summary>
            private static Vector3 mTarget;

            /// <summary>
            /// the target of the camera
            /// </summary>
            public static Vector3 InitTarget
            {
                get { return CameraSettings.mTarget; }
                set { CameraSettings.mTarget = value; }
            }

            /// <summary>
            /// the up vector of the camera
            /// </summary>
            private static Vector3 mUp;

            /// <summary>
            /// the up vector of the camera
            /// </summary>
            public static Vector3 InitUpVector
            {
                get { return CameraSettings.mUp; }
                set { CameraSettings.mUp = value; }
            }

            public static void read()
            {
                XmlTextReader XmlRdr = new System.Xml.XmlTextReader("Content/Settings/CameraSettings.xml");
                mPosition = readVector(XmlRdr, "InitPosition");
                mTarget = readVector(XmlRdr, "Target");
                mUp = readVector(XmlRdr, "Up");
                mFieldOfView = readFloat(XmlRdr,"FOV");
                mNearPlane = readFloat(XmlRdr,"NearPlane");
                mFarPlane = readFloat(XmlRdr, "FarPlane");
                XmlRdr.Close();
            }
        }
    }
}
